package com.hspedu.newData.dmsxl.数组.双指针;

import java.util.Arrays;

/**
 * @Author: yh
 * @description:
 * @CreateTime: 2025-04-29
 * @Version: 1.0
 */

public class LC274H指数 {

    // todo
    public int hIndex(int[] citations) {

        Arrays.sort(citations);
        int h = 0;
        int i = citations.length - 1;

        while (i >= 0 && citations[i] > h) {
            h++;
            i--;
        }

        return h;
    }
}
